# -*- coding: utf-8 -*-
"""
comments
"""
import json


def main():
    IN_FILE = "/Users/tzp/Desktop/src.txt"
    OUT_FILE = "/Users/tzp/Desktop/dst.json"

    result = {}
    with open(IN_FILE, "r", encoding="gbk") as fd:
        for line in fd:
            model, brand = line.strip().split("\t")
            
            arr = result.get(brand)
            if arr is None:
                result[brand] = []
                arr = result.get(brand)
            arr.append(model)
            

    with open(OUT_FILE, "w")as fd:
        json.dump(result, fd, indent=2, ensure_ascii=False)


if __name__ == '__main__':
    main()
    print("done")
